<?php /* Smarty version Smarty-3.1.18, created on 2017-09-05 15:50:24
         compiled from "/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/goods.list.html" */ ?>
<?php /*%%SmartyHeaderCode:1591798729597348df9c1e76-58311323%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '1c62d9d11642348f20921816ad836152d30fd3d1' => 
    array (
      0 => '/Applications/MAMP/htdocs/PHP/jifenshop/protected/template/wap/goods.list.html',
      1 => 1504597176,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1591798729597348df9c1e76-58311323',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_597348dfb8cf41_43226939',
  'variables' => 
  array (
    'data' => 0,
    'category_id' => 0,
    'order_field' => 0,
    'ext_property' => 0,
    'title' => 0,
    'order_sort' => 0,
    'g' => 0,
    'brand_id' => 0,
    'min_price' => 0,
    'max_price' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_597348dfb8cf41_43226939')) {function content_597348dfb8cf41_43226939($_smarty_tpl) {?><body class="gr">

<div class="navBar">
	<a class="left" href="javascript:history.back()"><i class="return"></i></a>
	<div class="titleView"><?php if (isset($_smarty_tpl->tpl_vars['data']->value['category']->name)) {?><?php echo $_smarty_tpl->tpl_vars['data']->value['category']->name;?>
<?php } else { ?>商品列表<?php }?></div>
</div>

<div class="goods-list main-padding-top width-wrap">
	<div class="pullRefresh" category_id="<?php if (isset($_smarty_tpl->tpl_vars['category_id']->value)) {?><?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
<?php }?>">
		<!--<header class="ge-bottom ge-light">
			<ul class="switchView">
				<li <?php if (!isset($_smarty_tpl->tpl_vars['order_field']->value)) {?>class="this"<?php }?>>
					<a href="wap.php?app=goods&act=index<?php if (isset($_smarty_tpl->tpl_vars['category_id']->value)) {?>&category_id=<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['ext_property']->value)) {?>&ext_property=<?php echo $_smarty_tpl->tpl_vars['ext_property']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['title']->value)) {?>&title=<?php echo $_smarty_tpl->tpl_vars['title']->value;?>
<?php }?>">综合</a>
				</li>
				<li <?php if (isset($_smarty_tpl->tpl_vars['order_field']->value)&&$_smarty_tpl->tpl_vars['order_field']->value=='sales') {?>class="this"<?php }?>>
					<a href="wap.php?app=goods&act=index<?php if (isset($_smarty_tpl->tpl_vars['category_id']->value)) {?>&category_id=<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['ext_property']->value)) {?>&ext_property=<?php echo $_smarty_tpl->tpl_vars['ext_property']->value;?>
<?php }?>&order_field=sales<?php if (isset($_smarty_tpl->tpl_vars['order_sort']->value)) {?>&order_sort=<?php if ($_smarty_tpl->tpl_vars['order_sort']->value=='desc') {?>asc<?php } else { ?>desc<?php }?><?php }?><?php if (isset($_smarty_tpl->tpl_vars['title']->value)) {?>&title=<?php echo $_smarty_tpl->tpl_vars['title']->value;?>
<?php }?>">销量</a>
				</li>
				<li <?php if (isset($_smarty_tpl->tpl_vars['order_field']->value)&&$_smarty_tpl->tpl_vars['order_field']->value=='price') {?>class="this"<?php }?>>
					<a href="wap.php?app=goods&act=index<?php if (isset($_smarty_tpl->tpl_vars['category_id']->value)) {?>&category_id=<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['ext_property']->value)) {?>&ext_property=<?php echo $_smarty_tpl->tpl_vars['ext_property']->value;?>
<?php }?>&order_field=price<?php if (isset($_smarty_tpl->tpl_vars['order_sort']->value)) {?>&order_sort=<?php if ($_smarty_tpl->tpl_vars['order_sort']->value=='desc') {?>asc<?php } else { ?>desc<?php }?><?php } else { ?>&order_sort=asc<?php }?><?php if (isset($_smarty_tpl->tpl_vars['title']->value)) {?>&title=<?php echo $_smarty_tpl->tpl_vars['title']->value;?>
<?php }?>">价格</a>
				</li>
				<li>
					<a class="filter" href="javascript:void(0)">筛选</a>
				</li>
			</ul>
		</header>-->
		<ul class="list goods-item">
			<?php  $_smarty_tpl->tpl_vars['g'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['g']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value['goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['g']->key => $_smarty_tpl->tpl_vars['g']->value) {
$_smarty_tpl->tpl_vars['g']->_loop = true;
?>
			<li>
				<a href="wap.php?app=goods&act=detail&goods_id=<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
&integral=1">
					<div class="pic" style="background-image:url(<?php echo $_smarty_tpl->tpl_vars['g']->value->default_pic;?>
);"></div>
					<div class="title"><div><?php echo $_smarty_tpl->tpl_vars['g']->value->name;?>
</div><font class="btn"><b>立即兑换</b></font><span class="integral"><?php echo $_smarty_tpl->tpl_vars['g']->value->integral;?>
积分</span></div>
				</a>
			</li>
			<?php } ?>
		</ul>
	</div>
</div>

<script>
var offset = $('.pullRefresh .list > li').length;
function createHtml(g){
	var html = '<li>\
		<a href="wap.php?app=goods&act=detail&goods_id='+g.id+'&integral=1">\
			<div class="pic" style="background-image:url('+g.default_pic+');"></div>\
			<div class="title"><div>'+g.name+'</div><font class="btn"><b>立即兑换</b></font><span class="integral">'+g.integral+'积分</span></div>\
		</a>\
	</li>';
	offset++;
	return html;
}
function setLists(){
	var width = ($('.pullRefresh').width()-10*3) / 2;
	$('.list li').width(width);
	$('.list a .pic').loadbackground();
}
setLists();
$(window).resize(setLists);
$(function(){
	$('header').sticky({ scroller:$('.pullRefresh') });
	$('html, body, .pullRefresh').addClass('height-wrap');
	$('.goods-list').height($.window().height-$('.goods-list').padding().top);
	/*$('.switchView').switchView({ column:'column', index:$('.switchView .this').index() });*/
	$('.filter').click(function(){
		getFilter(function(){
			var filterView = this;
			setTitleView();
			filterView.find('.reset').click(function(){
				filterView.find('form')[0].reset();
			});
			filterView.find('.btn').click(function(){
				var category = filterView.find('[name="category_id"]:checked'), brand = filterView.find('[name="brand_id"]:checked'),
					title = category.length ? category.attr('title') : '<?php if (isset($_smarty_tpl->tpl_vars['title']->value)) {?><?php echo $_smarty_tpl->tpl_vars['title']->value;?>
<?php }?>',
					min_price = filterView.find('#min_price').val(), max_price = filterView.find('#max_price').val(),
					category_id = category.length ? category.val() : '<?php if (isset($_smarty_tpl->tpl_vars['category_id']->value)) {?><?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
<?php }?>',
					brand_id = brand.length ? brand.val() : '';
				location.href = 'wap.php?app=goods&act=index&category_id='+category_id+<?php if (isset($_smarty_tpl->tpl_vars['ext_property']->value)) {?>'&ext_property=<?php echo $_smarty_tpl->tpl_vars['ext_property']->value;?>
'+<?php }?>'&brand_id='+brand_id+'&min_price='+min_price+'&max_price='+max_price+'&title='+title.urlencode();
			});
		});
	});
	$('.pullRefresh').pullRefresh({
		header : true,
		footer : true,
		footerNoMoreText : '- END -',
		refresh : function(fn){
			var _this = this;
			offset = 0;
			$.getJSON('api.php?app=goods&act=index<?php if (isset($_smarty_tpl->tpl_vars['category_id']->value)) {?>&category_id=<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['ext_property']->value)) {?>&ext_property=<?php echo $_smarty_tpl->tpl_vars['ext_property']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['brand_id']->value)) {?>&brand_id=<?php echo $_smarty_tpl->tpl_vars['brand_id']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['min_price']->value)) {?>&min_price=<?php echo $_smarty_tpl->tpl_vars['min_price']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['max_price']->value)) {?>&max_price=<?php echo $_smarty_tpl->tpl_vars['max_price']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['order_field']->value)) {?>&order_field=<?php echo $_smarty_tpl->tpl_vars['order_field']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['order_sort']->value)) {?>&order_sort=<?php echo $_smarty_tpl->tpl_vars['order_sort']->value;?>
<?php }?>', function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data.goods))for(var i=0; i<json.data.goods.length; i++)html += createHtml(json.data.goods[i]);
				_this.find('.list').html(html);
				setLists();
				fn();
			});
		},
		load : function(fn){
			var _this = this;
			$.getJSON('api.php?app=goods&act=index<?php if (isset($_smarty_tpl->tpl_vars['category_id']->value)) {?>&category_id=<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['ext_property']->value)) {?>&ext_property=<?php echo $_smarty_tpl->tpl_vars['ext_property']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['brand_id']->value)) {?>&brand_id=<?php echo $_smarty_tpl->tpl_vars['brand_id']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['min_price']->value)) {?>&min_price=<?php echo $_smarty_tpl->tpl_vars['min_price']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['max_price']->value)) {?>&max_price=<?php echo $_smarty_tpl->tpl_vars['max_price']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['order_field']->value)) {?>&order_field=<?php echo $_smarty_tpl->tpl_vars['order_field']->value;?>
<?php }?><?php if (isset($_smarty_tpl->tpl_vars['order_sort']->value)) {?>&order_sort=<?php echo $_smarty_tpl->tpl_vars['order_sort']->value;?>
<?php }?>', { offset:offset }, function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data.goods))for(var i=0; i<json.data.goods.length; i++)html += createHtml(json.data.goods[i]);
				_this.find('.list').append(html);
				setLists();
				fn();
			});
		}
	});
});

function getFilter(fn){
	var html = '<div class="filterView" cls="filterView-face">\
		<div>\
			<div class="navBar">\
				<div class="titleView">筛选</div>\
			</div>\
			<form onSubmit="return false">\
			<ul class="tableView tableView-noMargin tableView-light main-top">\
				<li><h1>\
					<div class="label">类别</div>\
					<div>\
						<?php if (count($_smarty_tpl->tpl_vars['data']->value['categories'])) {?><?php  $_smarty_tpl->tpl_vars['g'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['g']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value['categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['g']->key => $_smarty_tpl->tpl_vars['g']->value) {
$_smarty_tpl->tpl_vars['g']->_loop = true;
?><span><input type="radio" name="category_id" id="category<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
" value="<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
" title="<?php echo str_replace("'","\'",$_smarty_tpl->tpl_vars['g']->value->name);?>
" /><label for="category<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
"><div><?php echo str_replace("'","\'",$_smarty_tpl->tpl_vars['g']->value->name);?>
</div></label></span><?php } ?><?php } else { ?><span><input type="radio" name="category_id" id="category<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
" value="<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
" title="<?php if (isset($_smarty_tpl->tpl_vars['title']->value)) {?><?php echo str_replace("'","\'",$_smarty_tpl->tpl_vars['title']->value);?>
<?php }?>" /><label for="category<?php echo $_smarty_tpl->tpl_vars['category_id']->value;?>
"><div><?php if (isset($_smarty_tpl->tpl_vars['title']->value)) {?><?php echo str_replace("'","\'",$_smarty_tpl->tpl_vars['title']->value);?>
<?php }?></div></label></span><?php }?>\
						<div class="clear"></div>\
					</div>\
				</h1></li>\
				<li><h1>\
					<div class="label">价格</div>\
					<div>\
						<font>价格区间(元)</font><font><input type="tel" name="min_price" id="min_price" placeholder="最低价" /> - <input type="tel" name="max_price" id="max_price" placeholder="最高价" /></font>\
						<div class="clear"></div>\
					</div>\
				</h1></li>\
				<li><h1>\
					<div class="label">品牌</div>\
					<div>\
						<?php  $_smarty_tpl->tpl_vars['g'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['g']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value['brands']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['g']->key => $_smarty_tpl->tpl_vars['g']->value) {
$_smarty_tpl->tpl_vars['g']->_loop = true;
?><span><input type="radio" name="brand_id" id="brand<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
" value="<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
" /><label for="brand<?php echo $_smarty_tpl->tpl_vars['g']->value->id;?>
"><div><?php echo str_replace("'","\'",$_smarty_tpl->tpl_vars['g']->value->name);?>
</div></label></span><?php } ?>\
						<div class="clear"></div>\
					</div>\
				</h1></li>\
			</ul>\
			</form>\
			<div class="bottomView ge-top ge-light">\
				<a class="btn" href="javascript:void(0)">确定</a><a class="reset gr" href="javascript:void(0)">重置</a>\
			</div>\
		</div>\
	</div>';
	var face = $.overlay(html, function(){
		var face = this, close = $('<div style="width:100%;height:100%;"></div>');
		face.prepend(close);
		close.click(function(){
			$.overlay(false, function(){
				face.find('.filterView').removeClass('filterView-x');
				setTimeout(function(){ face.remove() }, 310);
			});
		});
		setTimeout(function(){ face.find('.filterView').addClass('filterView-x') }, 0);
	});
	fn.call(face.find('.filterView'));
}
</script><?php }} ?>
